import re
EMOTICON_POS = "posemoticon"
EMOTICON_NEG = "negemoticon"
hairRegex = r"[oO>\}\]\)]?"
eyesRegex = r"[:;8]"
subeyesRegex = r"[',]?"
noseRegex = r"-?"
mouthRegex = "(\){1,3}|\({1,3}|[\|\]\[><\#@\*\$sdpco])"
happyMouthRegex = r"(\){1,3}|[\|\]>\#@\*\$sdpco])"
sadMouthRegex = r"(\({1,3}|[\|\[<])"
beardRegex = r"=?"
emoticonRegex = hairRegex + eyesRegex + subeyesRegex + noseRegex + mouthRegex + beardRegex
happyRegex = hairRegex + eyesRegex + subeyesRegex + noseRegex + happyMouthRegex + beardRegex
sadRegex = hairRegex + eyesRegex + subeyesRegex + noseRegex	+ sadMouthRegex + beardRegex
def normalize(text):
	happyMatch = re.compile(happyRegex)
	sadMatch = re.compile(sadRegex)
	return re.sub(sadRegex, EMOTICON_NEG, re.sub(happyRegex,EMOTICON_POS,text))